﻿ <%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Insert title here</title>
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/themes/default/easyui.css" />
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/themes/default/tree.css" />
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/themes/icon.css" />
		<link rel="stylesheet" href="${pageContext.request.contextPath}/css/ainit.css" type="text/css"></link>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.8.3.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.easyui.min.1.3.1.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/locale/easyui-lang-zh_CN.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.json-2.4.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/model/js/jquery.ainit-1.1.0.js"></script>
<!--		<script type="text/javascript" src="${pageContext.request.contextPath}/model/sysRight/userRight.js"></script>-->
		<script type="text/javascript" src="${pageContext.request.contextPath}/model/sysRight/userToRight.js"></script>
	<script type="text/javascript">
	</script>
	<script type="text/javascript">
		$(function(){
			loadUserCol(); //加载用户列
			$('#tt').tabs({  
			    onSelect:function(title){  
			    	if(title == '用户权限'){
			    		userPerms();
			    	}else if(title == '所属角色组'){
			    		userGroupPerms();
			    	}else if(title == '权限搜索'){
			    		var quBut = $('#seacQu');
			    		searchMGB(quBut,'0');
			    	}else{
			        }
			    }  
			});
			$("#allUserPerms input[type='checkbox']").click(function(){
					this.checked = !this.checked;
			}); 
	});
	</script>
	</head>
	<body class="easyui-layout" style="overflow-y: hidden">
		<!-- 用layout 将左右分栏 -->
		 <div data-options="region:'west' "  style="width:270px; height:650px; overflow-y:hidden;" id="taskWest">
 			<div>
				<table class='tableBord' id="caq_commUseU" style="float: left;">
					<tr>
						<td>员工名称：</td>
						<td><input type="text" id='caq_userName' onkeydown="if(event.keyCode==13) _w_bquery();"/></td>
					</tr>
				</table>
				<span>
					<a class='easyui-linkbutton' href="#" onclick="_w_bquery()" id='caq_taskQuery'  pre='caq' dsid='ds_bs_operators' tit='' flagStr='0' >查询</a>
				</span>
			</div>
			<table cellpadding="0" cellspacing="0" style="padding-top: 5px;">
				<tr>
					<td colspan="2" >
						<!-- 员工列表 -->	
						<table id="caq_USERLIST" ></table>
					</td>
				</tr>
			</table>
		</div>
		<div data-options="region:'center'" style=" height:650px; padding-left: 1px;"  id="cat_QueryTaskList" >  
			<div id="tt" class="easyui-tabs" >
				<div title="所属角色组" style="overflow:auto;">
					<div>
						<a class="easyui-linkbutton"  href="#" onclick="saveUserGroup()">保存</a>
					</div>
					<div style="display:inline-block;zoom:1;text-align: left;padding-top:10px;">
						<div id="d_uid_19" style="width:800px;height: 800px;">
							<div class="caption-bar">
								<div class="collapse-button" onclick="closeP(this)"></div>
								<div class="caption">角色组</div>
								<div class="bar-right"></div>
							</div>
							<div class="body" style="position: relative;">
								 <div id="queryGroup" class="d-container-ui-default" style="overflow: hidden; position: relative; text-align: left;padding-top:10px;">
									 <table style="border-collapse:collapse; width: 800px;">
										<c:forEach items="${m.bumenList}" var="blist" >
											<tr>
												<td style="width: 50px;">
													<!-- 模块Id -->
													<div style="float: left;">
<!--													 	<input type="checkbox" bid='${blist.MAN_ID}'  />-->
													 	<span style="cursor: pointer;">${blist.M_NAME}:</span>
													</div>
												</td>
											</tr>
											<tr>
												<td>  </td>
												<td>
													<c:forEach items="${m.groupList}" var="glist">
														<c:if test="${blist.MAN_ID == glist.BUMEN}">
														 	<div style="float: left;">
														 		<input type="checkbox" gid='${glist.GROUP_ID}' /><span style="cursor: pointer;" onclick="checkboxUSel(this,4)">${glist.GROUP_NAME}</span>
															</div>
														</c:if>
													</c:forEach>
												</td>
											</tr>
										</c:forEach>
									 </table>
								</div>
							</div>
						</div>
		        	</div>
				</div>
				<div title="用户权限" style="overflow:auto;"  >
					<table>
						<tr>
							<td>
<!--								<a class="easyui-linkbutton"  href="#" onclick="saveRightuser()">保存</a>-->
							</td>
						</tr>
						<tr>
							<td id="allUserPerms">
								<c:forEach items="${m.modelList}" var="mlist" >
									<div style="display:inline-block;zoom:1;text-align: left;padding-top:10px;">
										 <div id="d_uid_22" style="width:800px;">
											<div class="caption-bar">
												<div class="collapse-button" onclick="closeP(this)"></div>
												<div class="caption">${mlist.menuName}</div>
												<div class="bar-right"></div>
											</div>
											<div class="body" style="position: relative;" >
												<div class="d-container-ui-default" style="overflow: hidden; position: relative; text-align: left;">
													<table style="border-collapse:collapse; width: 800px;">
														<tr>
															<td style="width: 100px;">
																<!-- 模块Id -->
																<div style="float: left;">
																 	<!-- <input type="checkbox" mid='${mlist.menuId}'  onclick="modChange(this)" /><span onclick="checkboxUSel(this,0)" style="cursor: pointer;">${mlist.menuName}:</span> -->
																 		<input type="checkbox" mid='${mlist.menuId}'  /><span style="cursor: pointer;">${mlist.menuName}:</span>
																 </div>
															</td>
															<td  style="border-bottom: 1px solid #8db2e3;width: 150px; "> 
																<div style="float: left;">
															 		<!-- <input type="checkbox"  onclick="chengeAllFuncU(this)" /><span onclick="checkboxUSel(this,1)" style="cursor: pointer;">全选/全取消</span>-->
															 		 <input type="checkbox"   /><span  style="cursor: pointer;">全选/全取消</span>
															 		
															    </div>
															</td>
															<td>   </td>
														</tr>
														<!-- 循环dsList -->
														<c:forEach items="${m.dataStroeList}" var="dl">
														 	<!-- 如果   功能的模块Id == 模块Id  -->
															<c:if test="${mlist.menuId == dl.MODUAL_ID}">
																<tr gn='T'>
<!--																	<td>   </td>-->
																	<td>   </td>
																	<td style=" border-left: 1px solid #8db2e3;border-right: 1px solid #8db2e3; border-bottom: 1px solid #8db2e3;">
																		<!-- 该功能的Id -->
																		<div style="float: left;">
																			<!-- <input type="checkbox" funcId='${dl.FUNC_ID}' modId='${dl.MODUAL_ID}' onclick="gnChange(this)" /><span onclick="checkboxUSel(this,2)" style="cursor: pointer;">${dl.FUNC_NAME}:</span> -->
																			 <input type="checkbox" funcId='${dl.FUNC_ID}' modId='${dl.MODUAL_ID}' /><span  style="cursor: pointer;">${dl.FUNC_NAME}:</span>
																		</div>
																	</td>
																	<td style="border-bottom: 1px solid #8db2e3;">
																		<!-- 循环butnList -->
																		<c:if test="${fn:length(m.butnList)>0}">
																			<c:forEach items="${m.butnList}" var="bl">
																				<!-- 如果  该功能的ds_id == 按钮的ds_id -->
																			    <c:if test="${dl.FUNC_ID == bl.FUNC_ID }">
																			    	<div style="float: left;">
																				   		<!--  <input type="checkbox" onclick="butnChange(this)"  butnId='${bl.BUTN_ID}' butnCode='${bl.BUTN_CODE}' comm = '0'  /><span onclick="checkboxUSel(this,3)" style="cursor: pointer;">${bl.BUTN_NAME}</span>-->
																				   		 <input type="checkbox"  butnId='${bl.BUTN_ID}' butnCode='${bl.BUTN_CODE}' comm = '0'  /><span  style="cursor: pointer;">${bl.BUTN_NAME}</span>
																					</div>
																			    </c:if>
																			</c:forEach>
																		</c:if>
																		<c:if test="${fn:length(m.commButnList)>0}">
																			<c:forEach items="${m.commButnList}" var="cbl">
																				<c:if test="${mlist.menuId != 'menu_10'}">
																			    	<div style="float: left;">
																				   		<!--  <input type="checkbox" onclick="butnChange(this)"  butnId='${cbl.DS_ID}' butnCode='${cbl.BUT_CODE}' comm = '1' /><span onclick="checkboxUSel(this,3)" style="cursor: pointer;">${cbl.BUTN_NAME}</span>-->
																						<input type="checkbox"   butnId='${cbl.DS_ID}' butnCode='${cbl.BUT_CODE}' comm = '1' /><span  style="cursor: pointer;">${cbl.BUTN_NAME}</span>
																					</div>
																				</c:if>
																			</c:forEach>
																		</c:if>
																	</td>
																</tr>
															</c:if>
														</c:forEach>
													</table>
												</div>
											</div>
										 </div>
									</div>
								</c:forEach>
							</td>
						</tr>
					</table>
				</div>
				<div title="权限搜索" style="overflow:auto;">
					<div id="" style="width:800px;height: 600px;">
						<table>
							<tr>
								<td>
									 <div>
						  				条件查询:<input type="text" id="configQuery" onkeydown="if(event.keyCode==13) searchMGB(this,1);"/>
						 			 </div>
								</td>
								<td>
									<a class="easyui-linkbutton" id="seacQu"  href="#" onclick="searchMGB(this,0)" >查询</a>
									<a class='easyui-linkbutton'  href='#' onclick='saveSearchPerms()'>保存</a>
								</td>
							</tr>
						</table>
						<div id="searchDiv"></div>
					</div>
				</div>
				<div title="数据范围" style="overflow:auto;">
					<div style="height:620px;border: 1px solid #99BBE8;">
				       <!-- 加载所有的菜单 -->
				        <div id="leftModelData" style="float: left; width:100px; height:100%; border-right: 1px solid #99BBE8;"  >
<!--				        	<c:forEach items="${m.modelList}" var="mlist" >-->
<!--					      		<div style=" cursor: pointer;" flag='0' onclick="selMoForAllDs(this)" mId='${mlist.menuId }'>-->
<!--						      		<p><img src="../model/images/jindu-no.png" />${mlist.menuName}</p>-->
<!--					      		</div>  -->
<!--				      		</c:forEach>-->
				        </div>
				        <div style="height: 100%;">
				        	<div id="dsDataSql" style="height: 92%;"><!--  border-bottom: 1px solid #99BBE8; -->
				        		<div id="dsByleftData" style="height:60%; border-bottom: 1px solid #99BBE8;"><!-- 加载ds -->
				        		
				        		</div>
				        		<div style="height: 20px;" >
									<span style="">原始SQL：</span>
								</div> 
				        		<div id="sqlRight">
				        			<textarea rows="4" cols="170" id="sqlTextDS" readonly="readonly"></textarea>
				        		</div>
				        		<div style="height: 20px; " >
									<span style="">SQL条件输入框：</span>
								</div> 
				        		<div id="sqlRight">
				        			<textarea rows="4" cols="170" id="sqlTextArea"></textarea>
				        		</div>
				        	</div>
				        	<div style="padding-left: 10px; padding-top: 3px;border-bottom: 1px solid #99BBE8;">
				   	    		<a class='easyui-linkbutton' href="#" onclick="saveWhereSql()">保存</a>
				   	   	 	</div>
				        </div>
			   	    </div>
				</div>
			</div>
		</div>
		<input type="hidden" id='zab_sq_pks'/>
		<input type="hidden" id="zab_dsId" value="${m.dsId}"/>
	</body>
</html>